
const data_config = require("./data_config");


module.exports = {
  nav_name: '消息管理',          //生成导航菜单
  module_name: 'news_m',     //生成路径，必须与文件名相同
  //接口
  api: `{
      add: commonPath + "/admin/information/add",              
      del: commonPath + '/admin/information/del',              
      edit: commonPath + '/admin/information/edit', 
      editState: commonPath + "/admin/information/editState",              
      get: commonPath + '/admin/information/get',              
      page: commonPath + '/admin/information/page',          
      
      sys_msg_page: cPath + "/user_notice/page", //系统消息分页
      sys_changeState: cPath + "/user_notice/editState", //改变状态
      sys_edit: cPath + "/user_notice/edit", //编辑
      sys_add: cPath + "/user_notice/add", //添加
      sys_del: cPath + "/user_notice/del", //删除
      sys_detail: cPath + "/user_notice/get", //详情
  }`,

  //消息列表
  table: {
    //isGenerate: "false",                    //false表示不生成页面
    table_name: "news_m_table",        //表页面名
    nav_name: "消息管理",                  //导航名
    tipsText: "消息管理 >> 消息列表",    //顶部文字
    // tableReqMethod: "get",  //分页请求配置成get方式, 默认为post
    // pageApi: "API.sys_setting.sys_setting_page",  //请求api
    // extraPageRequestParams: `
    //   courseId: this.$route.query.id,  //请求
    // `, //已有page和pageSize
    //配置列表页面
    tableData: [
      //类型normal(title定义名称  name定义动态绑定值  type定义类型  itemWidth定义宽度)
      { title: '序号', name: 'index', type: "normal", itemWidth: "60" },
      { title: '标题', name: 'title', type: "normal" },
      // { title: '内容', name: 'content', type: "normal" },
      {
        title: '视频地址',
        name: 'videoUrl',
        type: "innerCode",
        itemWidth: "300",
        innerCode: `<a target="_blank" :href="scope.row.videoUrl">{{scope.row.videoUrl || "-" }} </a>`,
      },
      //类型opts(showName定义动态绑定值  showObj定义匹配显示值)
      {
        title: '类型',
        name: 'type',
        type: "opts",
        showName: "typeShow",
        showObj: `{
            "1": "学院白问百答",
            "2": "最新动态",
            "3": "21天创富",
            "4": "操作视频教程",
          }`
      },
      {
        title: '阶段',
        name: 'stage',
        type: "opts",
        showName: "stageShow",
        showObj: `{
            "1": "1",
            "2": "2",
            "3": "3",
            "4": "4",
            "5": "5",
            "6": "6",
            "7": "7",
            "8": "8",
            "9": "9",
            "10": "10",
            "11": "11",
            "12": "12",
            "13": "13",
            "14": "14",
            "15": "15",
            "16": "16",
            "17": "17",
            "18": "18",
            "19": "19",
            "20": "20",
            "21": "21",
          }`
      },
      {
        title: '状态',
        name: 'state',
        type: "opts",
        showName: "stateShow",
        showObj: `{
            "1": "上架",
            "2": "下架",
          }`
      },
      {
        title: '封面图',
        name: 'img',
        type: "img",
        heightVal: "60",
        widthVal: "100",
      },
      { title: '创建时间', name: 'gmtCreated', type: "normal" },

    ],

    //配置列表操作项(type类型  text名称  request是否请求  jump跳转路由【本文件名+跳转文件名】 url接口 requestType请求方式)
    tableOpt: [
      //编辑跳转
      {
        type: "modify",
        text: "编辑",
        request: false,
        jump: "/news_m_add_news"
      },
      {
        type: "changeState",
        text: "上架",
        request: true,
        url: "API.news_m.editState",
        requestType: 'post',
        params: `{id,  state: 1 }`, //必须为文本 状态 1上架 2下架
        methodNameTag: 'Open', //方法衔接拓展名 changeState Black
        showCondition: `scope.row.state == '2'`,  //展示条件，没有就不传或置为空
      },
      {
        type: "changeState",
        text: "下架",
        request: true,
        url: "API.news_m.editState",
        requestType: 'post',
        params: `{id,  state: 2 }`, //必须为文本
        methodNameTag: 'Close', //方法衔接拓展名 changeState Black
        showCondition: `scope.row.state == '1'`,  //展示条件，没有就不传或置为空
      },
      //删除功能
      {
        type: "del",
        text: "删除",
        request: true,
        url: "API.news_m.del",
        requestType: 'get',
        // isSplitSearchString: 'true',  //拼接查询字符串（post需要，get不需要）。
      },


    ],

    //配置搜索栏
    search: {
      //筛选
      contentArr: {
        //labelName定义名称  inputName定义动态绑定值
        input1: { labelName: '标题', inputName: 'title', labelWidth: '150' },
        //selectOptsName自定义名称  selectOptsArr下拉内容  labelWidth定义宽度
        select1: {
          labelName: '状态',
          inputName: 'state',
          selectOptsName: "stateOpts",
          selectOptsArr: `[
                  { value: "", label: "全部" },
                  { value: "1", label: "上架" },
                  { value: "2", label: "下架" },
                ],
                `,
        },
        select2: {
          // labelWidth: "120",
          labelName: '类型',
          inputName: 'type',
          selectOptsName: "typeOpts",
          selectOptsArr: `[
                    { value: "", label: "全部" },
                    { value: "1", label: "学院白问百答" },
                    { value: "2", label: "最新动态" },
                    { value: "3", label: "21天创富" },
                    { value: "4", label: "操作教程视频" },
                ],
                `,
        },


      },
      //查找按钮的文字
      searchBtn: {
        //链接与table请求接口相同，不做另外配置
        text: "查询",
      },
      //添加按钮
      addBtn: {
        //(type类型  text名称  request是否请求  jump跳转路由【本文件名+跳转文件名】)
        type: "add",
        text: "新增",
        request: false,
        jump: "/news_m_add_news",
      }
    },
  },


  //添加页面
  add_page: {
    isGenerate: "false",  //做了判断                    //false表示不生成页面
    add_page_name: "add_news",          //尽量短些,要拼接路由
    tipsText: "消息管理 >> 新增消息",
    // pageApi: "API.sys_setting.sys_setting_page",  //请求api
    formData: {
      //titleText: "请填写商品信息",
      //(labelName定义名称  inputName定义绑定值 isNeed定义是否允许为空 disabled定义是否禁用 selectOptsName自定义名称 selectOptsArr定义下拉内容)
      input1: {
        labelName: '标题',
        inputName: 'title',
        isNeed: 'true',
        //disabled: 'true', 
      },
      select1: {
        labelName: '类型',
        inputName: 'type',  //输入绑定的变量
        selectOptsName: "typeOpts",
        selectOptsArr: `[
                { value: "1", label: "学院" },
                { value: "2", label: "最新动态" },
                { value: "3", label: "21天创富" },
              ],
              `, //选项数组
        isNeed: 'true',
      },
      select2: {
        labelName: '阶段',
        inputName: 'stage',  //输入绑定的变量
        selectOptsName: "stageOpts",
        selectOptsArr: `[
                { value: "1", label: "1" },
                { value: "2", label: "2" },
                { value: "3", label: "3" },
                { value: "4", label: "4" },
                { value: "5", label: "5" },
                { value: "6", label: "6" },
                { value: "7", label: "7" },
                { value: "8", label: "8" },
                { value: "9", label: "9" },
                { value: "10", label: "10" },
                { value: "11", label: "11" },
                { value: "12", label: "12" },
                { value: "13", label: "13" },
                { value: "14", label: "14" },
                { value: "15", label: "15" },
                { value: "16", label: "16" },
                { value: "17", label: "17" },
                { value: "18", label: "18" },
                { value: "19", label: "19" },
                { value: "20", label: "20" },
                { value: "21", label: "21" },
              ],
              `, //选项数组
        //isNeed: 'true',
      },
      //图片上传(type为many时可多张/single只能一张 countLimit定义图片张数  uploadMethod定义方法)
      uploadImg1: {
        labelName: "封面图",
        inputName: "img",
        type: "many",
        countLimit: "1",
        uploadMethod: "handleUpload1",
        isNeed: 'true',
      },
      //富文本组件 富文本组件添加默认背景
      richText1: {
        labelName: '内容',
        inputName: 'content',
        isNeed: 'true',
        minHeight: "180", //高度
        uploadApi: "API.common.upload",
        editContentChangeMethodName: "handleBgEditChange", //改变方法
        isNeed: 'true',
      },
      input4: {
        labelName: '视频地址',
        inputName: 'videoUrl',
        isNeed: 'true',
        //disabled: 'true', 
      },

    },
    addBtn: {
      //(text名称  url接口  extraParams请求的额外参数  extraQueryParams跳转时携带参数)
      text: '添加',
      url: "API.news_m.add",
      // extraParams: ` courseId: Number(this.$route.query.courseId), `,
      jumpPath: "/news_m_news_m_table",
      // extraQueryParams: ` { id: this.$route.query.courseId } `,      
    },
    editBtn: {
      text: '编辑',
      detailUrl: "API.news_m.get",              //默认get方式请求
      // detailType: 'get',                             //请求方式
      isSplitSearchString: 'true',                      //拼接查询字符串, get和post的必须字段
      // extraParams: ` courseId: Number(this.$route.query.courseId), `, //请求的额外参数
      editUrl: "API.news_m.edit",
      jump: '/news_m_news_m_table'
    },
    cancelBtn: { text: "取消" },
  },



  //系统消息列表
  table2: {
    // isGenerate: "false", //false表示不生成页面
    table_name: "sys_msg_t",  //表页面名
    nav_name: "系统消息列表",  //导航名
    tipsText: "消息管理 >> 系统消息列表", //顶部文字
    // tableReqMethod: "get",  //分页请求配置成get方式, 默认为post
    pageApi: "API.news_m.sys_msg_page",  //请求api
    // extraPageRequestParams: `
    //   courseId: this.$route.query.id,  //请求
    // `, //已有page和pageSize
    //获取列表页面
    tableData: [
      //普通
      { title: '序号', name: 'index', type: "normal" },
      { title: '编号', name: 'id', type: "normal" },
      {
        title: '类型',
        name: 'noticeType',
        type: "opts",
        showName: "noticeTypeShow",
        showObj: `{
          "1": "会员升级",
          "2": "创客升级",
          "3": "成为代理",
          "4": "系统消息 ",
        }`
      },
      {
        title: '是否显示',
        name: 'state',
        type: "opts",
        showName: "stateShow",
        showObj: `{
          "0": "否",
          "1": "是",
        }`
      },
      { title: '内容', name: 'content', type: "normal", itemWidth: "300" },
      { title: '创建时间', name: 'createDate', type: "normal" },
    ],
    tableOpt: [
      //编辑跳转
      {
        type: "modify",
        text: "编辑",
        request: false,
        jump: "/news_m_sys_add_page"
      },
      //删除功能
      {
        type: "del",
        text: "删除",
        request: true,
        url: "API.news_m.sys_del",
        requestType: 'post',
        // isSplitSearchString: 'true',  //拼接查询字符串（post需要，get不需要）。
      },

      {
        type: "changeState",
        text: "显示",
        request: true,
        url: "API.news_m.sys_changeState",
        requestType: 'post',
        params: `{id,  state: 1 }`, //必须为文本 状态 1上架 2下架
        methodNameTag: 'Open', //方法衔接拓展名 changeState Black
        showCondition: `scope.row.state == '0'`,  //展示条件，没有就不传或置为空
      },
      {
        type: "changeState",
        text: "不显示",
        request: true,
        url: "API.news_m.sys_changeState",
        requestType: 'post',
        params: `{id,  state: 0 }`, //必须为文本
        methodNameTag: 'Close', //方法衔接拓展名 changeState Black
        showCondition: `scope.row.state == '1'`,  //展示条件，没有就不传或置为空
      },
    ],
    search: {
      contentArr: {

      },
      //查找按钮的文字
      // searchBtn: {
      //   text: "查询", //链接与table请求接口相同，不做另外配置
      // },
      //添加按钮
      addBtn: {
        //搜索栏具有添加功能按钮时，设置此字段
        type: "add",
        text: "新增",
        request: false,
        jump: "/news_m_sys_add_page", //添加的跳转按钮
      }
    },
  },



  //系统消息添加页面
  
  //添加页面 有个bug add_page_name必须与add_pageX一起用
  add_page2: {
    // isGenerate: "false", //false表示不生成页面
    add_page_name: "sys_add_page",  //尽量短些,要拼接路由
    tipsText: "消息管理 >> 系统消息",
    // pageApi: "API.sys_setting.sys_setting_page",  //请求api
    formData: {
      //富文本组件 富文本组件添加默认背景
      richText1: {
        labelName: '系统消息',
        inputName: 'content',
        isNeed: 'true',
        minHeight: "180", //高度
        uploadApi: "API.common.upload",
        editContentChangeMethodName: "handleBgEditChange", //改变方法
        isNeed: 'true',
      },
    },
    addBtn: {
      text: '添加',
      url: "API.news_m.sys_add",
      // extraParams: ` courseId: Number(this.$route.query.courseId), `, //请求的额外参数
      jumpPath: "/news_m_sys_msg_t",
      // extraQueryParams: ` { id: this.$route.query.courseId } `, //跳转时携带参数
    },
    editBtn: {
      text: '编辑',
      detailUrl: "API.news_m.sys_detail", //默认get方式请求
      detailType: 'get', //请求方式
      // extraParams: ` courseId: Number(this.$route.query.courseId), `, //请求的额外参数
      editUrl: "API.news_m.sys_edit",
      jump: '/news_m_sys_msg_t'
    },
    cancelBtn: { text: "取消" }, //


  },



}

